PEBundle

©2000-2002 Collake Software
mailto: Support@CollakeSoftware.com

http://www.CollakeSoftware.com

 

 

PEBundle is a revolutionary tool that allows for DLLs or other files to be ‘bundled’ with an executable, therefore removing the requirement to distribute the bundled files separately from the application. With two operational modes, one that uses advanced techniques to resolve dependencies on a bundled DLL in memory, and another that writes the bundled file(s) to disk, PEBundle is a great tool to optimize software distributions.

 

PEBundle Features:

·        Effective static linking of a dynamic link library.

·        Makes applications and the bundled modules more difficult to reverse engineer and/or tamper with.

·        Helps to hide and protect the bundled modules.

·        Bundling of modules the application is dependent on allows for the application to be distributed as a single executable that is capable of installing modules it needs on the fly.

·        Reduces Dynamic Link Library version problems, a.k.a. “DLL Hell”. This problem is described by Microsoft in MSDN and they actually recommend that applications have their own copies of DLLs so that they will not cause version problems when they overwrite the system copy of the module.

·        Supports bundling of scripts to their respective interpreters and auto-launching.

·        Works with PECompact (another Collake Software product), so that your applications and all the modules may be compressed significantly. The write-to-disk module does have internal support for compression of the bundled modules.

·        Full support for Windows 95/98/Me/NT/2k/XP. The advanced bundle does hook and  support wide character, Unicode, APIs.

 

 

OVERVIEW OF IN-MEMORY BUNDLING BY PEBUNDLE:

 

This mode, called the “Advanced Bundle” in the GUI, allows dynamic link libraries to be bundled with an executable and have all references to those modules resolved at runtime to the appropriate memory addresses without ever writing the dynamic link libraries to disk*. The dependencies are resolved through the use of API hooks by the PEBundle loader, which is attached to the application.
    

* Under the Win9x kernel, for dynamic link libraries that contain resources, a ‘stub’ DLL of less than 4k in size may be written to the disk in order to ‘trick’ Windows resource APIs so that they are able to locate the module correctly. The WindowsNT kernel does not require this, resources work fine using pseudo-module handles defined by PEBundle. Dynamic Link Libraries that do not contain resources will not have this stub written to disk. This stub is created in the system temporary directory and is deleted when the application is closed.                     

 

 

OVERVIEW OF “WRITE-TO-DISK” BUNDLING:

 

In this mode, PEBundle simply uncompressed and extracts the modules to disk at runtime. This mode supports the bundling of any type of file.

 

The modules may be extracted to a location the user specifies at the time of bundle, and can optionally only be extracted if the module or a newer version of it does not already exist.

 

           

PEBundle Usage

 

 

PEBundle comes with two command line applications and a GUI to facilitate bundling in whatever fashion best suits the user. The modules are described below:

PEB-GUI: The PEBundle GUI. This application shells out to the console mode modules as necessary.

 

PEBundle: This is the original PEBundle that utilizes advanced techniques to resolve dependencies of a DLL in memory, therefore removing the requirement of the DLL to ever be extracted to disk. Be sure to test your bundled package thoroughly when using this mode, not all DLLs are compatible with it.

 

PEBundle-WTD: This version of PEBundle writes the bundled DLLs or files out to disk at runtime (hence the WTD acronym: Write-To-Disk).

 

 

GUI Usage


PEB-GUI is merely a shell that launches PEBUNDLE.EXE or PEBUNDLE-WTD.EXE for you. It allows for the easy creation of bundling ‘projects’ that can comprise of any number of modules bundled, with any combination of advanced and write-to-disk mode.

 

When the active selection in the tree view is the application, you may specify text to be appended to the application’s command line at runtime, if you wish. This is intended to allow for the support of automatic execution of scripts when bundled with their respective interpreters.

 

When the active selection in the tree view is one of the modules to be bundled, the following settings are available (these are set on a per-module basis):

 

            [   ] Advanced Bundle (Do not write module to disk at runtime)

This advanced PEBundle technique involves handling dependencies on   the DLL(s) in memory without ever having to extract the DLL(s) to disk. Warning: This technique may not work with all DLLs on all operating systems. One should carefully check the operation of the bundled executable after utilizing this method of bundling. Non-DLLs may not be bundled by this method. When using this option, none of the other toggles are applicable.

 

            [   ] Compress

This toggle compresses the file being bundled prior to bundling. Runtime decompression is extremely rapid, typically well within the time saved because less data has to be retrieved from the disk or network.

 

            [   ] Always extract

This toggle causes the bundled file to always be extracted, regardless if a newer, equal, or older copy of the file already exists in its target extraction path. Leaving this toggle unchecked causes PEBundle to only extract the bundled file if it does not already exist, or an older copy exists.

 

            [   ] Delete module when host executable terminates.

This toggle causes the PEBundle loader to delete the bundled module from disk after the host executable terminates. Host termination must occur via the ExitProcess API.

 

            For write-to-disk mode bundles, the destination folder may be one of the following:

                        System Folder              – Extracts to the system folder as given by GetSystemDirectory.

                        Runtime Folder             – Extracts to the current working directory at runtime.

                        Executable Folder         – Extracts to the folder containing the executable at runtime.

                        Windows Folder           – Extracts to the windows folder as given by GetWindowsDirectory.

                        Temporary Folder        – Extracts to the system temporary folder as given by GetTempPath.

                        Custom Folder             – Extracts to the folder that was typed into this field. This may be a relative or absolute path and should not include the                                                                           module name.

 

 

 

 

Command Line Usage


There are two command line versions of PEBundle, one facilitates the in-memory bundle while the other facilitates the write-to-disk bundle. Each of these tools is capable of bundling only one file at a time, meaning that you must run it more than once on the same application if you wish to bundle multiple files.

The write-to-disk executable, pebundle-wtd.exe, accepts the following parameters:

PEBUNDLE-WTD [exe] [module] [-d –c –w –t –f] [-u pathname] [-l extra command line text]

 

-d         = do not compress DLL.

-c         = extract to current working directory at runtime.

-e         = extract to directory containing the host executable at runtime.

-w        = extract to windows directory.

-t          = extract to temporary directory

-u         = extract to the directory that follows this switch. This should be
                           an absolute or relative path that does not include the module name.

-k         = (kill) delete extracted modules on program termination.

-f          = force extraction to disk. If this option is not specified, the

   module is overwritten if and only if its file data is older than

   that of the bundled module.

            -l          = This switch must be followed by text that should be appended to the

                           application’s command line at runtime. This allows for the automatic

                           execution of scripts when bundled to their respective interpreter.

            -!         = Do not create a backup of the executable before bundling.

           

            If -c, -e, -w, -t, or -u not specified, module will be extracted to system directory.

 

            EXAMPLE:

 

                        PEBUNDLE-WTD myapp.exe somefile.txt –c –l “-x somefile.txt”

This bundles somefile.txt with myapp.exe. At runtime, somefile.txt is extracted to disk in the current working directory. The command line for myapp.exe will have “-x somefile.txt” appended to it.

           

 

The advanced bundle executable, pebundle.exe, accepts the following parameters:

 

            PEBUNDLE [exe] [dll] [-l extra command line text] [-!]

 

            -l          = This switch must be followed by text that should be appended to the

                           application’s command line at runtime. This allows for the automatic

                           execution of scripts when bundled to their respective interpreter.        

            -!         = Do not create a backup of the executable before bundling.

 

 

 

Registration / Purchasing

                       

 

PEBundle is shareware, and as such requires registration for continued use. After a sufficient period of evaluation (14 days maximum), PEBundle must be registered. Registration entitles the user to all future updates of the product and priority technical support via email.

           

For information on purchasing/registering PEBundle, please visit http://www.CollakeSoftware.com .